<?php 
$prefixurl="huangguandianpu";

include("head.php");

function indexList($p_type,$num){
	global $prefix,$thispid;

	$sql="select * from ".$prefix."product where p_type='".$p_type."' order by p_id desc limit ".$num;
	$result=mysql_query($sql);
	$i=0;
	$a='';
	while($arr=mysql_fetch_array($result)){
		$a.= '<div class="fixed column" style="width:225px;">'.
		"<a title='".$arr['p_name']."' onclick=\"clickurl('".base64_encode(str_replace("15252836",$thispid,str_replace("15252835",$thispid,$arr['p_link'])))."');\"  href='javascript:;'>".
		'<script language="javascript">setPic("'.base64_encode($arr["p_pic"]).'","220","220","","");</script>'.
		"</a><br>"."<a title='".$arr['p_name']."' onclick=\"clickurl('".base64_encode(str_replace("15252836",$thispid,str_replace("15252835",$thispid,$arr['p_link'])))."');\"  href='javascript:;'>".$arr['p_name']."</a><h5>".$arr['p_price']."元</h5>".
		"</div>";
		$i++;
		if($i % 4 ==0){$a.= "<div class='separate'>&nbsp;</div>";}
	}
	return $a;
}

$tplFile="index.html";
$smar=new MySmarty($cache,$cachetime,$moban);
$smarty=$smar->get_smarty();
if(!$smarty->is_cached($tplFile)){
	$lady=indexList("女士",24);
	$man=indexList("男士",8);
	$dig=indexList("数码",4);
	$baby=indexList("母婴",4);
	$fur=indexList("居家",4);
	$snacks=indexList("零食",4);
	include("foot.php");
	
	//head
	$smarty->assign("thistitle",$thistitle);
	$smarty->assign("q",$q);
	$smarty->assign("result2",$result2);
	$smarty->assign("webname",$webname);
	$smarty->assign("postfix",$postfix);
	$smarty->assign("description",$description);
	$smarty->assign("keywords",$keywords);
	$smarty->assign("website",$website);
	$smarty->assign("searchkeys",$searchkeys);
	$smarty->assign("newshops",$newshops);
	$smarty->assign("toubiao",$show_topnav);
$smarty->assign("moban",$moban);
$smarty->assign("thispid",$thispid);

	//category
	$smarty->assign("prefixurl",$prefixurl);
	$smarty->assign("lcat",$lcat);
	$smarty->assign("lpro",$lpro);
	$smarty->assign("lpage",$lpage);
	$smarty->assign("rewrite_postfix",$rewrite_postfix);
	$smarty->assign("ljoin",$ljoin);
	//foot
	$smarty->assign("links",$links);
	$smarty->assign("QQ",$QQ);
	$smarty->assign("ICP",$ICP);
	$smarty->assign("tongji",$tongji);
$smarty->assign("jiathis",$jiathis);
	//index
	$smarty->assign("lady",$lady);
	$smarty->assign("man",$man);
	$smarty->assign("dig",$dig);
	$smarty->assign("baby",$baby);
	$smarty->assign("fur",$fur);
	$smarty->assign("lady",$lady);
	$smarty->assign("snacks",$snacks);
}
$smarty->display($tplFile);

?>